<%--
  Created by IntelliJ IDEA.
  User: Mr.杰
  Date: 2024/11/27
  Time: 19:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body>
<div class="x-body">
    <form id="form" class="layui-form" method="POST" action="${pageContext.request.contextPath}/supplier/updateSupplier.do" onsubmit="return updateSupplier()" >
        <input type="hidden" id="supplierId" name="supplierId">
        <div class="layui-form-item">
            <label for="supplierName" class="layui-form-label">
                <span class="x-red">*</span>供应商名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="supplierName" name="supplierName" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="creditCode" class="layui-form-label">
                <span class="x-red">*</span>社会统一信用代码
            </label>
            <div class="layui-input-inline">
                <input type="text" id="creditCode" name="creditCode" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="contactName" class="layui-form-label">
                <span class="x-red">*</span>联系人名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="contactName" name="contactName" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="phone" class="layui-form-label">
                <span class="x-red">*</span>联系电话
            </label>
            <div class="layui-input-inline">
                <input type="text" id="phone" name="phone" required lay-verify="phone" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="email" class="layui-form-label">
                <span class="x-red">*</span>电子邮箱
            </label>
            <div class="layui-input-inline">
                <input type="text" id="email" name="email" required lay-verify="email" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="address" class="layui-form-label">
                <span class="x-red">*</span>地址
            </label>
            <div class="layui-input-inline">
                <input type="text" id="address" name="address" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="registeredCapital" class="layui-form-label">
                注册资本
            </label>
            <div class="layui-input-inline">
                <input type="text" id="registeredCapital" name="registeredCapital" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="type" class="layui-form-label">
                <span class="x-red">*</span>企业类型
            </label>
            <div class="layui-input-inline">
                <input type="text" id="type" name="type" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="industry" class="layui-form-label">
                <span class="x-red">*</span>所属行业
            </label>
            <div class="layui-input-inline">
                <input type="text" id="industry" name="industry" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="registeredNo" class="layui-form-label">
                <span class="x-red">*</span>工商注册号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="registeredNo" name="registeredNo" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="registrationNumber" class="layui-form-label">
                <span class="x-red">*</span>纳税人识别号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="registrationNumber" name="registrationNumber" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="registrationDate" class="layui-form-label">
                <span class="x-red">*</span>注册时间
            </label>
            <div class="layui-input-inline">
                <input type="date" id="registrationDate" name="registrationDate" required lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="scope" class="layui-form-label">
                经营范围
            </label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="scope" name="scope" class="layui-textarea"></textarea>
            </div>
            <%--      <p id="charCount" style="float: right"></p>--%>
        </div>
        <div class="layui-form-item">
            <label for="registrationAuthority" class="layui-form-label">
                登记机关
            </label>
            <div class="layui-input-inline">
                <input type="text" id="registrationAuthority" name="registrationAuthority" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button class="layui-btn" lay-filter="add" lay-submit="">
                修改
            </button>
        </div>
    </form>
</div>
<script>
    var storedPageData = sessionStorage.getItem('data');
    var data = JSON.parse(storedPageData); // 读取后将字符串再转为对象
    console.log(data);

    $("#supplierId").val(data.supplierId)
    $("#supplierName").val(data.supplierName)
    $("#creditCode").val(data.creditCode)
    $("#contactName").val(data.contactName)
    $("#phone").val(data.phone)
    $("#email").val(data.email)
    $("#address").val(data.address)
    $("#registeredCapital").val(data.registeredCapital)
    $("#registrationDate").val(data.registrationDate)
    $("#scope").val(data.scope)
    $("#registrationAuthority").val(data.registrationAuthority)
    $("#type").val(data.type)
    $("#industry").val(data.industry)
    $("#registeredNo").val(data.registeredNo)
    $("#registrationNumber").val(data.registrationNumber)

    const textarea = document.getElementById('scope');
    const maxLength = 255;
    textarea.addEventListener('input', function () {
        if (this.value.length > maxLength) {
            this.value = this.value.slice(0, maxLength);
        }
    });

    function updateSupplier() {
        return true;
    }
</script>
</body>

</html>
